<template>
  <div class="view">
    <x-header :left-options="{backText: ''}" class="vux-1px-b">
      行车路线
    </x-header>
    <el-amap ref="map" vid="amapDemo" :amap-manager="amapManager" :zoom="12" :center="center" lang="zh_cn" :plugin="plugin" class="amap-demo">
      <el-amap-marker vid="component-marker" :position="componentMarker.position" ></el-amap-marker>
    </el-amap>
  </div>
</template>

<script>
import { XHeader } from 'vux'

export default {
  components: {
    XHeader
  },
  data () {
    return {
      lng: 0,
      lat: 0,
      center: [113.658075, 34.745793],
      amapManager: new this.$VueAMap.AMapManager(),
      plugin: ['ToolBar', 'MapType', 'Scale'],
      componentMarker: {
        position: [113.658075, 34.745793]
      }
    }
  },
  created () {
    this.$nextTick(() => {
      this.center = [this.$route.query.lng, this.$route.query.lat]
      this.componentMarker.position = [this.$route.query.lng, this.$route.query.lat]
    })
  }
}
</script>

<style lang="scss" scoped>
  @import "../../assets/css/pub";
  .amap-demo{
    height: calc(100vh - 1.226rem);
  }
</style>
